﻿using UnityEngine;
using System.Collections;

public class RaycastPlayer : MonoBehaviour {

	
	private void Update(){
		if(Input.GetMouseButtonDown(0)){
			Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);;
			RaycastHit hit;

			if(Physics.Raycast(ray, out hit)) {
				Debug.DrawLine (ray.origin, hit.point);
				if(hit.transform.tag.Equals("CannonTrigger")){
					//shoot
					print (hit.transform.name +" Shoot");
				}
			}
		}
	}
}